package com.example.octopus.service;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

 //微信用户Service实现类
@Service
public class IWxUserInfoServiceImpl implements IWxUserInfoService {
    @Value("${weixin.env}")
    String env;
    @Autowired
    DataBaseService impact;
    @Override
    public int getuserinfo(Object userInfo) {
        Gson gson=new Gson();
        JsonObject Juser=(JsonObject)userInfo;
        String nickName= (Juser).get("NickName").toString();
        String avatarUrl= (Juser).get("avatarUrl").toString();
        impact.update("user",env,nickName,avatarUrl);
        return 200;
    }
}
